#include <iostream>
#include <stdio.h>
#include <malloc.h>
#define LIST_INIT_SIZE 100
#define LISTNCREMENT 10
#define OK 1
#define ERROR 0
typedef int ElemType;
using namespace std;

typedef struct
{
    ElemType *elem;
    int length;
    int listsize;
}SqList;

int InitList_sq(SqList &L)
{
    L.elem=(ElemType*)malloc(LIST_INIT_SIZE*sizeof(ElemType));
    L.length=0;
    L.listsize=LIST_INIT_SIZE;
    return OK;
}

int Load_sq(SqList &L)
{
    int i;
    if(L.length==0)
        printf("The List is empty!");
    else
    {
        for(i=1;i<=L.length;i++)
            printf("%d ",L.elem[i]);
    }
    printf("\n");
    return OK;
}

int ListInsert_sq(SqList &L,int i,int e)
{
    if(i<0||i>L.length)
        return ERROR;
    ElemType *newbase,*p,*q;
    if(L.length>=L.listsize)
    {
        newbase=(ElemType*)realloc(L.elem,(L.listsize+LISTNCREMENT)*sizeof(ElemType));
        L.elem=newbase;
        L.listsize+=LISTNCREMENT;
    }
    q=&(L.elem[i+1]);
    for(p=&(L.elem[L.length]);p>=q;--p)
        *(p+1)=*p;
    *q=e;
    ++L.length;
    return OK;
}

int Partition(SqList &L,int low,int high)
{
    int pivotkey;
    L.elem[0]=L.elem[low];
    pivotkey=L.elem[low];
    while(low<high)
    {
        while(low<high&&L.elem[high]>=pivotkey)
            high--;
        L.elem[low]=L.elem[high];
        while(low<high&&L.elem[low]<=pivotkey)
            low++;
        L.elem[high]=L.elem[low];
    }
    L.elem[low]=L.elem[0];
    Load_sq(L);
    return low;
}

void QSort(SqList &L,int low,int high)
{
    int pivotloc;
    if(low<high)
    {
        pivotloc=Partition(L,low,high);
        QSort(L,low,pivotloc-1);
        QSort(L,pivotloc+1,high);
    }
}

void QuickSort(SqList &L)
{
    QSort(L,1,L.length);
}

int main()
{
    SqList L;
    int i,e,n;
    scanf("%d",&n);
    InitList_sq(L);
    for(i=0;i<n;i++)
    {
        scanf("%d",&e);
        ListInsert_sq(L,i,e);
    }
    QuickSort(L);
    return 0;
}
